//package com.xiaoyu.shenyou.shenyouv1.task;
//
//import cn.hutool.json.JSONUtil;
//import com.xiaoyu.shenyou.shenyouv1.common.shenyoucode.ToServerCode;
//import com.xiaoyu.shenyou.shenyouv1.utils.SpringContextUtils;
//import com.xiaoyu.shenyou.shenyouv1.websocketclient.autorecordclient.RecordSocketClient;
//import com.xiaoyu.shenyou.shenyouv1.websocketclient.toserverentity.ToServerEntity;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//@Component
//@Slf4j
//public class AutoEnableTask {
//
//    private RecordSocketClient recordSocketClient;
//
//    /**
//     * 定时检测自启动状态
//     */
//    @Scheduled(cron = "0/5 * * * * ?")
//    public synchronized void enableRecordJobHandler() {
//        if (RecordSocketClient.startFlag()) {
//            //已经启动了就跳过,进行心跳检测
//            ToServerEntity toServerEntity = new ToServerEntity();
//            toServerEntity.setCode(ToServerCode.PING).setData("ping");
//            recordSocketClient.send(JSONUtil.toJsonStr(toServerEntity));
//            //发送自己的位置
//            return;
//        }
//        log.info("生成一个实例");
//        recordSocketClient = SpringContextUtils.getContext().getBean(RecordSocketClient.class);
//        recordSocketClient.connect();
//    }
//}
